import 'package:flutter/material.dart';
import 'package:fun4live/pages/liveListView.dart';
import 'package:get/get.dart';
import 'mainPageController.dart';
import 'appSytyle.dart';
import '../controller/sites.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

class mainPageView extends GetView<mainPageController>{
  const mainPageView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context){
        Get.put(mainPageController());
    return Scaffold(
      appBar: AppBar(
        titleSpacing: 8,
        title:TabBar(
         controller: controller.tabController,
         labelPadding: AppStyle.edgeInsetsH20,
         tabs: Sites.supportSites
              .map((e) => Tab(
                    child:Column(
                          children: [
                            Image.asset(
                                e.logo,
                                width:24
                                ),
                            AppStyle.hGap8,
                            Text(e.name),
                          ],
                          ),
                ),
            ).toList(),
        ),
        actions: [
          IconButton(
            onPressed: (){},
            icon: const Icon(Icons.search),
            )
        ],
      ),
      body: TabBarView(
         controller: controller.tabController,
        children:Sites.supportSites
            .map(
              (e) => liveListView(
                 e.id,
               
              ),
            )
            .toList(),
      ),

    );
  }
}